package cn.cyl.basic.listener;

import cn.cyl.sys.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class PermissionScanInitListener implements ServletContextListener {

    @Autowired
    private PermissionService permissionService;


    @Override
    public void contextInitialized(ServletContextEvent sce) {
        //扫描我们的自定义注解: 获取name 和sn
        //扫描每个接口类:1.类上的@RequestMapping  2.每个方法上XxxMappering

        new Thread(new Runnable() {
            @Override
            public void run() {

                permissionService.scanPermission();
            }
        }).start();
    }
}
